<?php
include_once('common/header.php');
$strRefer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
/* if($strRefer == '') {
	$arrJson 	= array('error'=>1,'msg'=>$arrError[1]);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
	exit();
} */
$intAction 		= $objRequest->getParam('act',null);
$intError		= 0;
$objOffline 	= new Offline();
$strMessage		= '';
$intLike		= 0;
if(isset($intAction)) {
	if($intAction == 1) {
		if($AppUI->id > 0) {
			include_once('offline/match.php');
			$this->view->ajax = 1;
			$objView		= Zend_Registry::get('objView');			
			$strOffline		= $objView->fetch('offline/match.tpl');
			$arrJson		= array('error'		=> $intError, 	
									'doffline'  => $strOffline);
			echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
			exit();
		} else {
			$intError 	= 1;
		}
	}elseif($intAction == 2) {
		include_once('offline/public.php');
		$this->view->ajax = 1;
		$objView		= Zend_Registry::get('objView');			
		$strOffline		= $objView->fetch('offline/public.tpl');
		$arrJson		= array('error'		=> $intError, 	
								'doffline'  => $strOffline);
		echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
		exit();
	}elseif($intAction == 3) {
		include_once('offline/category.php');
		$this->view->ajax = 1;
		$objView		= Zend_Registry::get('objView');			
		$strOffline		= $objView->fetch('offline/category.tpl');
		$arrJson		= array('error'		=> $intError, 	
								'doffline'  => $strOffline);
		echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
		exit();
	}elseif($intAction == 4) {
		include_once('offline/mine.php');
		$this->view->ajax = 1;
		$objView		= Zend_Registry::get('objView');			
		$strOffline		= $objView->fetch('offline/mine.tpl');
		$arrJson		= array('error'		=> $intError, 	
								'doffline'  => $strOffline);
		echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
		exit();
	}
	elseif($intAction == 5) {		
		$intOfflineId = $objRequest->getParam('offlineid', 0);
		include_once('offline/box-registed.php');
		$this->view->jajax 			= 1;
		$this->view->intOfflineId 	= $intOfflineId;
		$this->view->intOwnerId 	= Vfriend_Function::base64D($strOwnerId);
		$objView		= Zend_Registry::get('objView');			
		$strOffline		= $objView->fetch('offline/box-registed.tpl');
		$arrJson		= array('error'	=> $intError, 	
								'data'  => $strOffline);
		echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
		exit();
	}
	elseif($intAction == 6) {		
		$intOfflineId = $objRequest->getParam('offlineid', 0);
		include_once('offline/box-accept.php');
		$this->view->jajax 			= 1;
		$this->view->intOfflineId 	= $intOfflineId;
		$this->view->intOwnerId 	= Vfriend_Function::base64D($strOwnerId);
		$objView		= Zend_Registry::get('objView');			
		$strOffline		= $objView->fetch('offline/box-accepted.tpl');
		$arrJson		= array('error'	=> $intError, 	
								'data'  => $strOffline);
		echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
		exit();
	}
	elseif($intAction == 7) {		
		include_once('offline/expired.php');
		$this->view->ajax = 1;
		$objView		= Zend_Registry::get('objView');			
		$strOffline		= $objView->fetch('offline/expired.tpl');
		$arrJson		= array('error'		=> $intError, 	
								'doffline'  => $strOffline);
		echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';	
		exit();
	}
}	
if($intError > 0) {
	$arrJson 	= array('error'=>$intError,'msg'=>$arrError[$intError]);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
}
exit();
?>
